const fp = require('lodash/fp')
const { Maybe, Container } = require('./support')

let maybe = Maybe.of([5, 6, 11])

//练习1
let ex1 = (val) => {
  maybe.map(arr => arr.push(val))
}
ex1(8)
console.log(maybe)

//练习2（也许题意没理解）
let xs = Container.of(['do', 'ray', 'me', 'fa', 'so', 'la', 'ti', 'do'])
let ex2 = () => {
  return fp.first(xs._value)
}
console.log(ex2())

//练习3（没理解safeProp有什么用，直接用取user.name不就行了吗）
let safeProp = fp.curry(function (x, o) {
  return Maybe.of(o[x])
})
let user = { id: 2, name: 'Albert' }
let ex3 = () => {
  
}

//练习4
let ex4 = function (n) {
  let r = Maybe.of(n).map(res => parseInt(res))
  return r._value
}
console.log(ex4('-'))